﻿using System;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;

public class ShakeScreen : MonoBehaviour
{
	private Tweener _tweener = null;
	
	// Use this for initialization
	void Start ()
	{
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	public void OnClick()
	{
		if (_tweener == null)
		{
			_tweener = transform.DOShakePosition(1, new Vector3(3, 3, 3));
			_tweener.SetAutoKill(false);
			_tweener.Pause();
		}

		_tweener.Restart();
	}

	private void OnDestroy()
	{
		_tweener.Kill();
	}
}
